home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / docume1a / docproce next >
Encoding:
Text File  |  1999-09-10  |  19.7 KB  |  601 lines

  1. Attribute VB_Name = "DocProcedures"
  2.  
  3. 'Functions of the document application
  4. 'Save Functions, Close Functions, and Exit
  5. 'Functions.  Created so that frmOpenDoc
  6. 'can call the functions, instead of making
  7. 'them public in the MDIForm.
  8.  
  9.  
  10. 'SAVE PROCEDURES
  11. '===============
  12.  
  13. Public Function SaveEnabled()
  14.     If boolnew = False Then
  15.         MDIForm1.mnuSave.Enabled = True
  16.         MDIForm1.Toolbar1.Buttons(3).Enabled = True
  17.         MDIForm1.mnuSaveAs.Enabled = True
  18.         MDIForm1.Toolbar1.Buttons(4).Enabled = True
  19.     Else
  20.         MDIForm1.mnuSaveAs.Enabled = True
  21.         MDIForm1.Toolbar1.Buttons(4).Enabled = True
  22.     End If
  23. End Function
  24. Public Function SaveDisabled()
  25.     MDIForm1.mnuSaveAs.Enabled = False
  26.     MDIForm1.mnuSave.Enabled = False
  27.     MDIForm1.Toolbar1.Buttons(3).Enabled = False
  28.     MDIForm1.Toolbar1.Buttons(4).Enabled = False
  29. End Function
  30. Public Function SaveDoc()
  31.         If GetAttr(MDIForm1.CommonDialog1.filename) And vbReadOnly Then
  32.             MsgBox MDIForm1.CommonDialog1.filename & " is a read only file. It cannot be saved."
  33.             bCannotSave = True
  34.             Exit Function
  35.         End If
  36.  
  37.         If boolnew = True Then
  38.             frmOpenDoc.RichTextBox1.SelStart = 0
  39.             frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  40.             boolsave = True
  41.             MDIForm1.mnuSave.Enabled = False
  42.             MDIForm1.Toolbar1.Buttons(3).Enabled = False
  43.         Else
  44.             frmOpenDoc.RichTextBox1.SelStart = 0
  45.             frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog1.filename
  46.             boolsave = False
  47.             MDIForm1.mnuSave.Enabled = True
  48.             MDIForm1.Toolbar1.Buttons(3).Enabled = False
  49.         End If
  50. End Function
  51. Public Function SaveNew()
  52.     On Error GoTo ErrHandler
  53.     MDIForm1.CommonDialog2.Flags = &H2 'File exists
  54.     MDIForm1.CommonDialog2.ShowSave
  55.     frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  56.     boolsave = False
  57.     ControlsDisabled
  58.     Exit Function
  59. ErrHandler:
  60.     Cancel = True
  61. End Function
  62. Public Function SaveAs()
  63.     On Error GoTo ErrHandler
  64.     MDIForm1.CommonDialog2.Flags = &H2 'File exists
  65.     MDIForm1.CommonDialog2.ShowSave
  66.     frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  67.     boolsave = False
  68.     boolnew = False
  69.     frmOpenDoc.Caption = MDIForm1.CommonDialog2.filename
  70.     MDIForm1.StatusBar1.Panels(1).Text = MDIForm1.CommonDialog2.filename
  71.     MDIForm1.mnuPrintPreview.Enabled = True: MDIForm1.Toolbar1.Buttons(7).Enabled = True
  72.     MDIForm1.mnuDelete.Enabled = True: MDIForm1.Toolbar1.Buttons(5).Enabled = True
  73.     Exit Function
  74. ErrHandler:
  75.     Cancel = True
  76. End Function
  77.  
  78. 'CLOSING PROCEDURES
  79. '==================
  80.  
  81. Public Function CloseNew()
  82. Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  83. MDIForm1.CommonDialog2.CancelError = True
  84. On Error GoTo ErrHandler
  85.     Select Case Response
  86.         Case vbYes
  87.             Call SaveAs
  88.             Call CloseNew1
  89.         Case vbNo
  90.             Call ControlsDisabled
  91.             Call CloseNew1
  92.     End Select
  93. Exit Function
  94. ErrHandler:
  95. Cancel = True
  96. End Function
  97. Public Function CloseModExisting()
  98.         If boolsave = True Then
  99.             Response = MsgBox("  Do You Want To Save Changes ", vbQuestion + vbYesNoCancel)
  100.             On Error GoTo ErrHandler
  101.         Select Case Response
  102.             Case vbYes
  103.                 Call SaveDoc
  104.                 If bCannotSave = False Then
  105.                     Call CloseModExisting1
  106.                 End If
  107.             Case vbNo
  108.                 Call CloseModExisting1
  109.         End Select
  110.         Else
  111.             Call ControlsDisabled
  112.             frmOpenDoc.RichTextBox1.Visible = False
  113.         End If
  114. ErrHandler:
  115. Exit Function
  116. End Function
  117. Public Function CloseFile()
  118.         If boolnew = True And boolsave = True Then
  119.             Call CloseNew
  120.         Else
  121.             If boolsave = True Then
  122.                 Call CloseModExisting
  123.             Else
  124.                 Call ControlsDisabled
  125.                 frmOpenDoc.RichTextBox1.Visible = False
  126.             End If
  127.         End If
  128. End Function
  129.  
  130. 'EXIT PROCEDURES
  131. '===============
  132.  
  133. Public Function ExitDoc()
  134.         If boolsave = True And boolnew = True Then
  135.             Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  136.             MDIForm1.CommonDialog2.CancelError = True
  137.             On Error GoTo ErrHandler
  138.         Select Case Response
  139.             Case vbYes
  140.                 Call SaveAs
  141.                 End
  142.             Case vbNo
  143.                 End
  144.         End Select
  145.         Else
  146.             If boolsave = True And boolnew = False Then
  147.                 Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  148.                 MDIForm1.CommonDialog2.CancelError = True
  149.                 On Error GoTo ErrHandler
  150.             Select Case Response
  151.                 Case vbYes
  152.                     Call SaveDoc
  153.                     End
  154.                 Case vbNo
  155.                     End
  156.             End Select
  157.             Else
  158.                 End
  159.             End If
  160.         End If
  161. ErrHandler:
  162. Exit Function
  163. End Function
  164.  
  165. 'OPEN PROCEDURES
  166. '===============
  167.  
  168. Public Function OpenDocument()
  169.     Call SaveDisabled
  170.     Dim currLine&
  171.     boolsave = False
  172.     boolnew = False
  173.     MDIForm1.CommonDialog1.CancelError = True
  174.     On Error GoTo ErrHandler
  175.     MDIForm1.CommonDialog1.ShowOpen
  176.     Screen.MousePointer = 11
  177.     DoEvents 'added to hide the Open dialog while loading.
  178.     MDIForm1.StatusBar1.Panels(1).Text = "Loading file, please wait..."
  179.     frmOpenDoc.Visible = True
  180.     frmOpenDoc.RichTextBox1.Visible = True
  181.     frmOpenDoc.WindowState = 0
  182.     frmOpenDoc.Width = Screen.Width * 0.89 ' Set width of form.
  183.     frmOpenDoc.Height = Screen.Height * 0.61   ' Set height of form.
  184.     frmOpenDoc.RichTextBox1.LoadFile MDIForm1.CommonDialog1.filename
  185.     DoEvents
  186.     currLine& = SendMessageLong(frmOpenDoc.RichTextBox1.hwnd, EM_LINEFROMCHAR, -1&, 0&) + 1
  187.     MDIForm1.StatusBar1.Panels(4) = Format$(currLine&, "##,###")
  188.     MDIForm1.StatusBar2.Visible = False
  189.     frmOpenDoc.Caption = MDIForm1.CommonDialog1.filename
  190.     frmOpenDoc.SetFocus
  191.     MDIForm1.StatusBar1.Panels(1) = MDIForm1.CommonDialog1.filename
  192.     Screen.MousePointer = 0
  193.     Call ControlsEnabled
  194.     frmFind.Hide
  195.     frmReplace.Hide
  196.     boolnew = False
  197.     Exit Function
  198. ErrHandler:
  199.     Exit Function
  200. End Function
  201. Public Function OpenDocMod()
  202. Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  203. MDIForm1.CommonDialog2.CancelError = True
  204. On Error Resume Next
  205.         Select Case Response
  206.             Case vbYes
  207.                 OpenDocModify
  208.             Case vbNo
  209.                 ControlsDisabled
  210.                 frmOpenDoc.Visible = False
  211.                 Call OpenFile
  212.         End Select
  213. frmFind.Hide
  214. frmReplace.Hide
  215. Exit Function
  216. ErrHandler:
  217. Exit Function
  218. End Function
  219. Public Function OpenFile()
  220.         If boolnew = True And boolsave = True Then
  221.             Call OpenDocMod
  222.         Else
  223.             If boolsave = True Then
  224.                 Call OpenCloseModExisting
  225.             Else
  226.                 Call OpenDocument
  227.             End If
  228.         End If
  229. End Function
  230. Public Function OpenCloseModExisting()
  231.         If boolnew = True And boolsave = True Then
  232.             Call OpenDocMod
  233.         Else
  234.             If boolsave = True Then
  235.                 Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  236.                 On Error GoTo ErrHandler
  237.             Select Case Response
  238.                 Case vbYes
  239.                     Call SaveDoc
  240.                     Call OpenDocument
  241.                 Case vbNo
  242.                     Call OpenDocument
  243.             End Select
  244.             Else
  245.                 Call OpenDocument
  246.             End If
  247.         frmFind.Hide
  248.         frmReplace.Hide
  249.         End If
  250.         Exit Function
  251.         
  252. ErrHandler:
  253. Exit Function
  254.  
  255. End Function
  256. Public Function DocUnload()
  257.         If boolnew = True And boolsave = True Then
  258.             Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  259.             MDIForm1.CommonDialog2.CancelError = True
  260.             On Error GoTo ErrHandler
  261.                 Select Case Response
  262.                     Case vbYes
  263.                         On Error GoTo ErrHandler
  264.                         MDIForm1.CommonDialog2.Flags = &H2 'File exists
  265.                         MDIForm1.CommonDialog2.ShowSave
  266.                         frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  267.                         boolsave = False
  268.                         Exit Function
  269.                         End
  270.                     Case vbNo
  271.                         End
  272.                 End Select
  273.             Else
  274.                 If boolsave = True Then
  275.                     Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  276.                     MDIForm1.CommonDialog2.CancelError = True
  277.                     On Error GoTo ErrHandler
  278.                 Select Case Response
  279.                     Case vbYes
  280.                         Call SaveDoc
  281.                         If bCannotSave = False Then
  282.                             End
  283.                         End If
  284.                     Case vbNo
  285.                         End
  286.                 End Select
  287.                 Else
  288.                     End
  289.                 End If
  290.         End If
  291. ErrHandler:
  292. Cancel = True
  293. End Function
  294.  
  295. '==============
  296. 'Creating the spelling object
  297.  
  298. Public Function Spelling()
  299. Dim Speller         As Object
  300. Dim txt             As String
  301. Dim new_txt         As String
  302. Dim pos             As Integer
  303.   
  304.   MDIForm1.StatusBar1.Panels(1).Text = "Loading spelling object, please wait..."
  305.   On Error GoTo OpenError
  306.   Set Speller = CreateObject("Word.Basic")
  307.   On Error GoTo ErrorTrap
  308.   Screen.MousePointer = 11
  309.  
  310.   Speller.FileNew
  311.   Speller.Insert frmOpenDoc.RichTextBox1.Text
  312.   Screen.MousePointer = 0
  313.   If boolnew = True Then
  314.     MDIForm1.StatusBar1.Panels(1) = MDIForm1.CommonDialog2.filename
  315.   Else
  316.     MDIForm1.StatusBar1.Panels(1) = MDIForm1.CommonDialog1.filename
  317.   End If
  318.  
  319.   Speller.ToolsSpelling
  320.   Speller.EditSelectAll
  321.  
  322.   txt = Speller.selection()
  323.   Speller.FileExit 2
  324.   If Right$(txt, 1) = vbCr Then
  325.     txt = Left$(txt, Len(txt) - 1)
  326.     new_txt = ""
  327.     pos = InStr(txt, vbCr)
  328.     Do While pos > 0
  329.     new_txt = new_txt & Left$(txt, pos - 1) & vbCrLf
  330.     txt = Right$(txt, Len(txt) - pos)
  331.     pos = InStr(txt, vbCr)
  332.     Loop
  333.     new_txt = new_txt & txt
  334.     frmOpenDoc.RichTextBox1.Text = new_txt
  335.     txt = ""
  336.  
  337.   End If
  338.     MsgBox "The Spelling Check has completed "
  339. txt = ""
  340.     Exit Function
  341. OpenError:
  342.    
  343.    ' MsgBox "Error" & Str$(Error.Number) & " opening word." & vbCrLf & Error.Description
  344. ErrorTrap:
  345. Call ErrorTrap
  346. End Function
  347. Public Function ErrorTrap()
  348. MsgBox "Document has encountered an error.  Error# " + Str$(Err) + Chr(10) + Chr(13) + Chr(10) + Error$ + Chr(13) + Chr(10) + Chr(10) + "Document will continue"
  349. End Function
  350. Public Function NewModExisting()
  351.         If boolsave = True Then
  352.             Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  353.             On Error GoTo ErrHandler
  354.         Select Case Response
  355.             Case vbYes
  356.                 Call SaveNew
  357.                 Call NewModExisting1
  358.                 MDIForm1.mnuPaste.Enabled = True
  359.                 MDIForm1.Toolbar1.Buttons(14).Enabled = True
  360.             Case vbNo
  361.                 Call ControlsDisabled
  362.                 Call NewModExisting1
  363.                 MDIForm1.mnuPaste.Enabled = True
  364.                 MDIForm1.Toolbar1.Buttons(14).Enabled = True
  365.         End Select
  366.         Else
  367.             Call ControlsDisabled
  368.             MDIForm1.mnuTimeDate.Enabled = True
  369.             boolnew = True
  370.             frmOpenDoc.SetFocus
  371.         End If
  372. ErrHandler:
  373. Exit Function
  374. End Function
  375. Public Function OpenDocModify()
  376. On Error GoTo ErrHandler
  377. MDIForm1.CommonDialog2.Flags = &H2 'File exists
  378. MDIForm1.CommonDialog2.ShowSave
  379. frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  380. boolsave = False
  381. Call OpenDocument
  382. Exit Function
  383. ErrHandler:
  384. Cancel = True
  385. End Function
  386.  
  387. Public Function PrintDoc()
  388. 'MDIForm1.CommonDialog3.CancelError = True
  389. 'On Error GoTo ErrHandler
  390. 'MDIForm1.CommonDialog3.ShowPrinter
  391. 'X = Printer.ScaleWidth / 2
  392. 'Y = Printer.ScaleHeight / 2
  393. 'Printer.CurrentX = X
  394. 'Printer.CurrentY = Y
  395. 'Printer.Circle Step(0, 0), 1500
  396. 'Printer.FillStyle = 0
  397. 'Printer.CurrentX = X
  398. 'Printer.CurrentY = Y + 800
  399. 'For i = O To 4
  400. 'Printer.FillColor = QBColor(i)
  401. 'Printer.Circle Step(0, -800), i * 200 + 100
  402. 'Next i
  403. 'Printer.CurrentX = 0
  404. 'Printer.CurrentY = 0
  405. 'Printer.FontSize = 24
  406. 'Printer.Print frmOpenDoc.RichTextBox1.Text
  407. 'Printer.EndDoc
  408. 'ErrHandler:
  409. 'Exit Function
  410.  
  411. 'Printer.Print frmOpenDoc.RichTextBox1.Text
  412. Printer.PrintQuality = vbPRPQMedium
  413.  
  414. With frmOpenDoc.RichTextBox1
  415.     .SaveFile MDIForm1.CommonDialog1.filename, rtfRTF
  416.     .SelStart = 0
  417.  On Error Resume Next
  418.     While Len(.Text) > 0
  419.         Screen.MousePointer = 11
  420.         .SelLength = InStr(.SelStart + 1, .Text, vbCrLf) + 1
  421.         Printer.Font.Name = .SelFontName
  422.         Printer.Font.Size = .SelFontSize
  423.         Printer.Font.Bold = .SelBold
  424.         Printer.Print Mid(.SelText, 1, .SelLength)
  425.         .SelText = ""
  426.         .SelStart = 0
  427.     Wend
  428.     
  429.     .LoadFile MDIForm1.CommonDialog1.filename, rtfRTF
  430. End With
  431.  
  432. Printer.EndDoc
  433. Screen.MousePointer = 0
  434. End Function
  435.  
  436. Public Function CloseModExistNewDoc()
  437.         If boolsave = True Then
  438.             Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  439.             On Error GoTo ErrHandler
  440.         Select Case Response
  441.         Case vbYes
  442.             Call SaveDoc
  443.             If bCannotSave = False Then
  444.                 Call CloseDocument
  445.             End If
  446.         Case vbNo
  447.             Call CloseDocument
  448.         End Select
  449.         Else
  450.             Call ControlsDisabled
  451.             MDIForm1.mnuTimeDate.Enabled = True
  452.             frmOpenDoc.RichTextBox1.Visible = True
  453.             frmOpenDoc.SetFocus
  454.         End If
  455. ErrHandler:
  456. Exit Function
  457. End Function
  458. Public Sub CheckSoftware(X As Form)
  459. Dim SaveTitle$
  460. If App.PrevInstance Then
  461.   SaveTitle$ = App.Title
  462.   MsgBox "Document is already running." + Chr(10) + Chr(13) + Chr(10) + "Please close the other instance of Document, before running a new instance."
  463.   App.Title = ""
  464.   X.Caption = ""
  465.   AppActivate SaveTitle$
  466.   SendKeys "%{ENTER}", True
  467.   End
  468. End If
  469. End Sub
  470. Public Function RichTextKeyDown()
  471.         If boolnew = True Then
  472.             Dim currLine&
  473.             On Local Error Resume Next
  474.             currLine& = SendMessageLong(frmOpenDoc.RichTextBox1.hwnd, EM_LINEFROMCHAR, -1&, 0&) + 1
  475.             With MDIForm1
  476.                 .StatusBar1.Panels(4) = Format$(currLine&, "##,###")
  477.                 .Toolbar1.Buttons(4).Enabled = True
  478.                 .mnuSaveAs.Enabled = True
  479.                 .Combo2.Enabled = True
  480.                 .mnuPrint.Enabled = True: .Toolbar1.Buttons(6).Enabled = True
  481.                 .mnuCut.Enabled = True: .Toolbar1.Buttons(12).Enabled = True
  482.                 .mnuCopy.Enabled = True: .Toolbar1.Buttons(13).Enabled = True
  483.                 .mnuPaste.Enabled = True: .Toolbar1.Buttons(14).Enabled = True
  484.                 .mnuFind.Enabled = True
  485.                 .mnuReplace.Enabled = True
  486.                 .Toolbar1.Buttons(18).Enabled = True
  487.                 .mnuFormatText.Enabled = True
  488.                 .mnuWordCount.Enabled = True
  489.                 .mnuSpelling.Enabled = True: .Toolbar1.Buttons(16).Enabled = True
  490.                 .Toolbar1.Buttons(22).Enabled = True
  491.                 .Toolbar1.Buttons(23).Enabled = True
  492.                 .Toolbar1.Buttons(24).Enabled = True
  493.                 .Toolbar1.Buttons(25).Enabled = True
  494.                 .Toolbar1.Buttons(29).Enabled = True
  495.                 .Toolbar1.Buttons(30).Enabled = True
  496.                 .Toolbar1.Buttons(31).Enabled = True
  497.                 .mnuSelectAll.Enabled = True
  498.                 .mnuTimeDate.Enabled = True
  499.                 boolsave = True
  500.             End With
  501.         Else
  502.             On Local Error Resume Next
  503.             currLine& = SendMessageLong(frmOpenDoc.RichTextBox1.hwnd, EM_LINEFROMCHAR, -1&, 0&) + 1
  504.             With MDIForm1
  505.                 .StatusBar1.Panels(4) = Format$(currLine&, "##,###")
  506.                 .Toolbar1.Buttons(4).Enabled = True: .mnuSaveAs.Enabled = True
  507.                 .Toolbar1.Buttons(3).Enabled = True: .mnuSave.Enabled = True
  508.                 .Combo2.Enabled = True
  509.                 .mnuPrint.Enabled = True: .Toolbar1.Buttons(6).Enabled = True
  510.                 .mnuCut.Enabled = True: .Toolbar1.Buttons(12).Enabled = True
  511.                 .mnuCopy.Enabled = True: .Toolbar1.Buttons(13).Enabled = True
  512.                 .mnuPaste.Enabled = True: .Toolbar1.Buttons(14).Enabled = True
  513.                 .mnuFind.Enabled = True
  514.                 .mnuReplace.Enabled = True
  515.                 .Toolbar1.Buttons(18).Enabled = True
  516.                 .mnuFormatText.Enabled = True
  517.                 .mnuWordCount.Enabled = True
  518.                 .mnuSpelling.Enabled = True: .Toolbar1.Buttons(16).Enabled = True
  519.                 .Toolbar1.Buttons(22).Enabled = True
  520.                 .Toolbar1.Buttons(23).Enabled = True
  521.                 .Toolbar1.Buttons(24).Enabled = True
  522.                 .Toolbar1.Buttons(25).Enabled = True
  523.                 .Toolbar1.Buttons(29).Enabled = True
  524.                 .Toolbar1.Buttons(30).Enabled = True
  525.                 .Toolbar1.Buttons(31).Enabled = True
  526.                 .mnuSelectAll.Enabled = True
  527.                 .mnuTimeDate.Enabled = True
  528.                 boolsave = True
  529.                 End With
  530.         End If
  531. End Function
  532. Public Function CloseDocument()
  533. Call ControlsDisabled
  534. boolnew = True
  535. With frmOpenDoc
  536.     .Visible = True
  537.     .RichTextBox1.Visible = True
  538.     .RichTextBox1.Enabled = True
  539.     .WindowState = 0
  540.     .SetFocus
  541.     .Width = Screen.Width * 0.89 ' Set width of form.
  542.     .Height = Screen.Height * 0.61   ' Set height of form.            frmOpenDoc.Top = (Screen.Height - Height) / 20 ' Center form vertically.
  543.     .Caption = "New Document"
  544. End With
  545.  
  546. MDIForm1.StatusBar1.Panels(1).Text = "Create a new Document"
  547. MDIForm1.mnuTimeDate.Enabled = True
  548. MDIForm1.Combo2.Enabled = True
  549. End Function
  550. Public Function NewModExisting1()
  551. boolnew = True
  552. MDIForm1.Combo2.Enabled = True
  553. MDIForm1.mnuTimeDate.Enabled = True
  554. MDIForm1.StatusBar1.Panels(1).Text = "Create a new Document"
  555.  
  556. With frmOpenDoc
  557.     .Visible = True
  558.     .WindowState = 0
  559.     .SetFocus
  560.     .RichTextBox1.Enabled = True
  561.  '   .Width = Screen.Width * 0.89 ' Set width of form.
  562.  '   .Height = Screen.Height * 0.61   ' Set height of form.
  563.  '   .Top = (Screen.Height - Height) / 20 ' Center form vertically.
  564.     .Caption = "New Document"
  565. End With
  566.  
  567. End Function
  568.  
  569. Public Function CloseModExisting1()
  570. Call ControlsDisabled
  571. boolnew = False
  572. 'MDIForm1.Combo2.Enabled = True
  573. MDIForm1.StatusBar1.Panels(1).Text = "Create a new Document"
  574. With frmOpenDoc
  575.     .Visible = False
  576.     .RichTextBox1.Visible = False
  577.     .WindowState = 0
  578.     .Width = Screen.Width * 0.89 ' Set width of form.
  579.     .Height = Screen.Height * 0.61   ' Set height of form.
  580.     .Top = (Screen.Height - Height) / 20 ' Center form vertically.
  581.     .Caption = "New Document"
  582. End With
  583.  
  584. End Function
  585.  
  586. Public Function CloseNew1()
  587. MDIForm1.mnuTimeDate.Enabled = True
  588. MDIForm1.Combo2.Enabled = True
  589. MDIForm1.StatusBar1.Panels(1).Text = "Create New Document"
  590. With frmOpenDoc
  591.     .Visible = True
  592.     .RichTextBox1.Visible = True
  593.     .RichTextBox1.Enabled = True
  594.     .Width = Screen.Width * 0.89 ' Set width of form.
  595.     .Height = Screen.Height * 0.61   ' Set height of form.            frmOpenDoc.Top = (Screen.Height - Height) / 400 ' Center form vertically.
  596.     .Caption = "New Document"
  597. End With
  598.  
  599. End Function
  600.  
  601.